home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / tpb4_src.zip / NETENTR.PAS < prev    next >
Pascal/Delphi Source File  |  1988-09-13  |  30KB  |  873 lines

  1. { TPBoard 4.2 Copyright (c) 1987,88 by Jon Schneider & Rick Petersen  
  2.   Portions Copyright (c) 1986,87 by Steve Fox and Les Archambault  
  3.   
  4.   Last modified  ::  7-15-88 1:14 pm 
  5. }
  6.  
  7. {$R-}                             {Range checking off}
  8. {$B-}                             {Boolean complete evaluation off}
  9. {$S-}                             {Stack checking off}
  10. {$I+}                             {I/O checking on}
  11. {$N-}                             {No numeric coprocessor}
  12.  
  13. Unit NetEntr;
  14.  
  15. Interface
  16.  
  17. Uses
  18.   TPCrt, Dos, Globals, Core1, Core2,
  19.   TPSTRING, TPDOS, NetMisc, MsgMove;
  20.   
  21.   
  22. procedure fido_mesg_enter(to_ctrl         : Char;
  23.                           to_name         : Str36;
  24.                           old_subject     : Str72;
  25.                           MsgToQuote      : Str10;
  26.                           var last_msg_num : Integer);
  27.                           
  28.                           
  29.   {==========================================================================}
  30.   
  31.   
  32. Implementation
  33.  
  34.  
  35.   procedure fido_mesg_enter(to_ctrl         : Char;
  36.                             to_name         : Str36;
  37.                             old_subject     : Str72;
  38.                             MsgToQuote      : Str10;
  39.                             var last_msg_num : Integer);
  40.     { Enter a new message }
  41.     
  42.   type
  43.     TextPtr         = ^TextRecord;
  44.     TextRecord =
  45.       record
  46.         LineNo          : Integer; { Line number }
  47.         TextMsg         : message; { Summary index }
  48.         next            : TextPtr { Pointer to next element on list }
  49.       end;
  50.       
  51.     Str4            = string[4];
  52.     
  53.   var
  54.     stop_msg,
  55.     abort, OK,
  56.     public, CRLF,
  57.     node_entrd,
  58.     quote,
  59.     attached_file   : Boolean;
  60.     ch              : Char;
  61.     low             : Byte;
  62.     last_line,
  63.     high_msg_num,
  64.     Number,
  65.     remaining       : Integer;
  66.     TextBase,
  67.     TextLast, This  : TextPtr;
  68.     subj            : Str72;
  69.     msgnum, reply   : Str10;
  70.     FidoDrv         : Str3;
  71.     temp_str        : Str4;
  72.     offset, nodes,
  73.     position        : Integer;
  74.     Buffer          : array[1..512] of Byte;
  75.     text_file,
  76.     msg_file        : untype_file;
  77.     subj_prompt,
  78.     fido_area       : StrStd;
  79.     quote_file      : Text;
  80.     mname           : Str13;
  81.     msg_line        : StrStd;
  82.     
  83.     
  84.     function In_Conference : Boolean;
  85.     
  86.     var
  87.       i               : Integer;
  88.       This            : AreaPtr;
  89.       
  90.     begin
  91.       This := AreaBase;
  92.       i := 0;
  93.       while (This <> nil) and (This^.AreaName <> AreaReq) do
  94.         This := This^.next;
  95.       if This^.AreaName = AreaReq then
  96.         i := This^.AreaConf and 7;
  97.       if i = 0 then
  98.         In_Conference := True
  99.       else
  100.         In_Conference := test_bit(user_rec.conf_flags, i);
  101.     end;
  102.     
  103.     
  104.     procedure GetLine(var line : StrStd);
  105.     
  106.     var
  107.       position,
  108.       character       : Byte;
  109.       
  110.     begin
  111.       line := ' > ';
  112.       position := 4;
  113.       repeat
  114.         {$I-}
  115.         Read(Byte_file, character) {$I+} ;
  116.         OK := (IoResult = 0);
  117.         if OK and (character <> 0) then
  118.           begin
  119.             case Chr(character) of
  120.               SOH :
  121.                 repeat
  122.                   {$I-}
  123.                   Read(Byte_file, character) {$I+} ;
  124.                   OK := (IoResult = 0);
  125.                 until (Chr(character) = CR) or (not OK);
  126.               SoftCR, CR, LF :
  127.                 begin
  128.                   {do nothing}
  129.                 end;
  130.               TAB :
  131.                 character := Ord(SPC);
  132.             else
  133.               begin
  134.                 line := line+Chr(character);
  135.                 Inc(position);
  136.               end;
  137.             end;
  138.           end;
  139.       until (not OK) or ((position > 58) and (character = Ord(SPC))) or
  140.       (position = 70) or (character = Ord(CR));
  141.       if (not OK) or (Pos('--- ', line) = 4) or (Pos(' * Origin:', line) = 4) then
  142.         line := ''
  143.       else
  144.         line := line+CR+LF;
  145.     end;
  146.     
  147.     
  148.     procedure fido_mesg_input(var last_line : Integer);
  149.       { Input message }
  150.       
  151.     var
  152.       ch              : Char;
  153.       This            : TextPtr;
  154.       msg             : StrStd;
  155.       
  156.     begin
  157.       WriteLn(com);
  158.       msg := ' ';
  159.       next_inpstr := '';
  160.       while (not brk) and (msg <> '') and (Online) do
  161.         begin
  162.           msg := next_inpstr;
  163.           if (last_line+1 = max_msg_lines) and (limit_lines) then
  164.             WriteLn(com, 'Two Lines Left');
  165.           if (last_line > max_msg_lines) and (limit_lines) then
  166.             msg := ''
  167.           else
  168.             begin
  169.               if quote then
  170.                 GetLine(msg)
  171.               else
  172.                 begin
  173.                   Write(com, last_line:2, '> ');
  174.                   GetStr(msg, ch, len_msg, 'AEWH');
  175.                   WriteLn(com)
  176.                 end;
  177.             end;
  178.           if msg <> '' then
  179.             if MaxAvail > 400 then
  180.               begin
  181.                 New(This);
  182.                 if TextBase = nil then
  183.                   TextBase := This
  184.                 else
  185.                   TextLast^.next := This;
  186.                 TextLast := This;
  187.                 TextLast^.LineNo := last_line;
  188.                 TextLast^.TextMsg := msg;
  189.                 TextLast^.next := nil;
  190.                 Inc(last_line)
  191.               end
  192.             else
  193.               begin
  194.                 WriteLn(com, 'Memory full.');
  195.                 msg := ''
  196.               end
  197.         end;
  198.     end;
  199.     
  200.     
  201.     procedure fido_mesg_edit;
  202.       { Edit selected line from message }
  203.       
  204.     var
  205.       ch              : Char;
  206.       i               : Integer;
  207.       This, prev      : TextPtr;
  208.       msg             : StrStd;
  209.       
  210.     begin
  211.       WriteLn(com);
  212.       Write(com, 'Edit message line...');
  213.       i := strint(prompt('Number', 2, 'E'));
  214.       This := TextBase;
  215.       prev := TextBase;
  216.       if i > 0 then
  217.         begin
  218.           while (i <> This^.LineNo) and (This <> nil) do {find line}
  219.             begin
  220.               prev := This;
  221.               This := This^.next;
  222.             end;
  223.           if This <> nil then
  224.             begin
  225.               CRLF := False;
  226.               msg := This^.TextMsg;
  227.               if Pos(CR, msg) <> 0 then
  228.                 begin
  229.                   Delete(msg, Length(msg)-1, 2);
  230.                   CRLF := True
  231.                 end;
  232.               Write(com, i:2, '> ');
  233.               GetStr(msg, ch, len_msg, 'EL');
  234.               WriteLn(com);
  235.               if msg <> '' then
  236.                 begin
  237.                   if CRLF then
  238.                     msg := msg+CR+LF;
  239.                   This^.TextMsg := msg
  240.                 end;
  241.             end
  242.           else
  243.             WriteLn(com, 'Not found.')
  244.         end;                      {i>0}
  245.     end;
  246.     
  247.     
  248.     procedure fido_mesg_delete;
  249.       { Delete selected lines from message }
  250.       
  251.     var
  252.       i, n            : Integer;
  253.       This, prev      : TextPtr;
  254.       
  255.     begin
  256.       WriteLn(com);
  257.       i := strint(prompt('Delete line number', 3, 'E'));
  258.       n := strint(prompt('    through number', 3, 'E'))+1;
  259.       if n > last_line then
  260.         n := last_line;
  261.       n := n-i;
  262.       if (i > 0) and (n > 0) then
  263.         repeat
  264.           This := TextBase;
  265.           prev := TextBase;
  266.           while (i <> This^.LineNo) and (This <> nil) do {find line}
  267.             begin
  268.               prev := This;
  269.               This := This^.next;
  270.             end;
  271.           if This <> nil then
  272.             begin
  273.               if (prev = TextBase) and (prev = This) then
  274.                 TextBase := This^.next
  275.               else
  276.                 prev^.next := This^.next;
  277.               Dispose(This);
  278.               if TextLast = This then
  279.                 TextLast := prev;
  280.               This := prev^.next;
  281.               while This <> nil do
  282.                 begin
  283.                   This^.LineNo := Pred(This^.LineNo);
  284.                   TextLast := This;
  285.                   This := This^.next;
  286.                 end;
  287.               Dec(last_line);
  288.               Dec(n);
  289.             end
  290.           else
  291.             begin
  292.               WriteLn(com, 'Not found.');
  293.               n := 0
  294.             end;
  295.         until n = 0;              {i>0}
  296.     end;
  297.     
  298.     
  299.     procedure fido_mesg_insert_line;
  300.       {modified by ret  -- 7/24/88}
  301.     var
  302.       ch              : Char;
  303.       i, line_count   : Integer;
  304.       This, prev, new_line : TextPtr;
  305.       msg             : StrStd;
  306.       
  307.     begin
  308.       WriteLn(Com);
  309.       i := strint(prompt('Insert before line...Number', 2, 'E'));
  310.       This := TextBase;
  311.       prev := TextBase;
  312.       if i > 0 then
  313.         begin
  314.           while (i <> This^.LineNo) and (This <> nil) do {find line}
  315.             begin
  316.               prev := This;
  317.               This := This^.next;
  318.             end;
  319.           if This <> nil then
  320.             begin
  321.               if (prev = TextBase) and (prev = This) then
  322.                 TextBase := nil   {inserting at very beginning}
  323.               else
  324.                 TextLast := prev; {end of top part of break}
  325.               line_count := i;    {save line count to current line}
  326.               fido_mesg_input(i); {insert (input) new lines}
  327.                    TextLast^.next := This; {connect tail of mesg to
  328.                                                      the newly inserted lines}
  329.               line_count := i-line_count; {calculate # of new lines}
  330.               while This <> nil do
  331.                 begin
  332.                   This^.LineNo := This^.LineNo+line_count;
  333.                   TextLast := This;
  334.                   This := This^.next;
  335.                 end;
  336.               Last_line := Last_line+line_count {update total line count}
  337.             end
  338.           else
  339.             WriteLn(Com, 'Not found.')
  340.         end;                      {i>0}
  341.     end;
  342.     
  343.     
  344.     procedure fido_mesg_print;
  345.       { Display message currently being edited }
  346.       
  347.     var
  348.       This            : TextPtr;
  349.       msg             : StrStd;
  350.       
  351.     begin
  352.       WriteLn(com);
  353.       WriteLn(com, 'From: ', UserFullName);
  354.       st := to_name;
  355.       caps_to_mixed(st);
  356.       WriteLn(com, '  To: ', st, ' ', msg_hdr.dest_net,
  357.         '/', msg_hdr.dest_node);
  358.       WriteLn(com, '  Re: ', subj);
  359.       WriteLn(com);
  360.       This := TextBase;
  361.       while (not brk) and (This <> nil) do
  362.         begin
  363.           msg := This^.TextMsg;
  364.           if Pos(CR, msg) <> 0 then
  365.             Delete(msg, Length(msg)-1, 2);
  366.           if (Pos(' > ', msg) = 1) then
  367.             WriteLn(com, This^.LineNo:2, ':', msg)
  368.           else
  369.             WriteLn(com, This^.LineNo:2, ': ', msg);
  370.           This := This^.next
  371.         end
  372.     end;
  373.     
  374.     
  375.     procedure fido_mesg_save(subj            : Str72;
  376.                              var stop_msg    : Boolean);
  377.       { Save message to disk }
  378.       
  379.     var
  380.       i               : Integer;
  381.       This            : TextPtr;
  382.       file_time       : tad_array;
  383.       Str             : Str20;
  384.       subj_str        : Str72;
  385.       OK              : Boolean;
  386.       msg_footer      : string;
  387.       
  388.     begin
  389.       WriteLn(com);
  390.       if AreaReq[1] <> '-' then
  391.         begin
  392.           user_rec.acct_bal := user_rec.acct_bal-node_hdr.node_cost;
  393.           if ask('Do you want this message to be public', 'N') then
  394.             begin
  395.               clear_bit(low, 0);
  396.               public := True;
  397.             end
  398.           else public := False;
  399.           if user_rec.access > 250 then
  400.             begin
  401.               if ask('Kill after mailing', 'N') then
  402.                 set_bit(low, 7);
  403.               if ask('Send via Crash mail', 'Y') then
  404.                 set_bit(low, 1)
  405.             end
  406.         end
  407.       else
  408.         begin
  409.           clear_bit(low, 0);
  410.           public := True
  411.         end;
  412.       GetTAD(file_time);
  413.       Str := Fido_FormTAD(file_time);
  414.       
  415.       with msg_hdr do
  416.         begin
  417.           FillChar(msg_from, 36, 0);
  418.           FillChar(msg_to, 36, 0);
  419.           FillChar(subject, 72, 0);
  420.           FillChar(date, 20, 0);
  421.           times := 0;
  422.           orig_node := this_node;
  423.           cost := node_hdr.node_cost;
  424.           orig_net := this_net;
  425.           prev_msg := $00;
  426.           attr_low := low;
  427.           attr_high := $01;
  428.           next_msg := $00;
  429.           Move(UserFullName[1], msg_from, Length(UserFullName));
  430.           {$V-}
  431.           caps_to_mixed(to_name) {$V+} ;
  432.           Move(to_name[1], msg_to, Length(to_name));
  433.           subj_str := subj;
  434.           Move(subj_str[1], subject, Length(subj_str));
  435.           Move(Str[1], date, Length(Str));
  436.         end;
  437.         
  438.       SetSect(fido_area);
  439.       Assign(fido_file, msgnum+'.MSG');
  440.       {$I-}
  441.       Rewrite(fido_file) {$I+} ;
  442.       OK := (IoResult = 0);
  443.       if OK then
  444.         begin
  445.           Write(fido_file, msg_hdr);
  446.           Close(fido_file);
  447.           Assign(fido_message, msgnum+'.TXT');
  448.           {$I-}
  449.           Rewrite(fido_message) {$I+} ;
  450.           OK := (IoResult = 0);
  451.           if OK then
  452.             begin
  453.               This := TextBase;
  454.               while This <> nil do
  455.                 begin
  456.                   Write(fido_message, This^.TextMsg);
  457.                   if Pos(LF, This^.TextMsg) = 0 then
  458.                     Write(fido_message, ' ');
  459.                   This := This^.next
  460.                 end;
  461.               Close(fido_message);
  462.               Assign(msg_file, msgnum+'.MSG');
  463.               {$I-}
  464.               Reset(msg_file, 1) {$I+} ;
  465.               OK := (IoResult = 0);
  466.               if OK then
  467.                 begin
  468.                   Seek(msg_file, FileSize(msg_file));
  469.                   Assign(text_file, msgnum+'.TXT');
  470.                   {$I-}
  471.                   Reset(text_file, 1) {$I+} ;
  472.                   OK := (IoResult = 0);
  473.                   if OK then
  474.                     begin
  475.                       remaining := 512;
  476.                       while remaining = 512 do
  477.                         begin
  478.                           BlockRead(text_file, Buffer, 512, remaining);
  479.                           BlockWrite(msg_file, Buffer, remaining);
  480.                         end;
  481.                       if AreaReq[1] = '-' then
  482.                         begin
  483.                           msg_footer := tear_line+sect_orig+seenby_line;
  484.                           for i := 1 to Length(msg_footer) do
  485.                             Buffer[i] := Ord(msg_footer[i]);
  486.                           BlockWrite(msg_file, Buffer, Length(msg_footer));
  487.                         end;
  488.                       for i := 1 to 5 do
  489.                         Buffer[i] := 0;
  490.                       BlockWrite(msg_file, Buffer, 5);
  491.                       Close(msg_file);
  492.                       Close(text_file);
  493.                       Erase(text_file)
  494.                     end;
  495.                 end;
  496.             end;
  497.         end;
  498.       if OK then
  499.         begin
  500.           WriteLn(com);
  501.           if public then
  502.             Write(com, 'Public')
  503.           else
  504.             Write(com, 'Private');
  505.           WriteLn(com, ' message ', msgnum, ' filed ', Str);
  506.           if AreaReq[1] <> '-' then
  507.             NetMsgEntr := 1
  508.           else
  509.             EchoMsgEntr := 2;
  510.           if to_ctrl = 'R' then
  511.             Inc(last_msg_num);
  512.         end
  513.       else
  514.         WriteLn(com, 'Message not filed due to I/O problems.');
  515.       stop_msg := True;
  516.       SetSect(HomName);
  517.     end;
  518.     
  519.     
  520.     procedure fido_mesg_quit(var stop_msg : Boolean);
  521.       { Return to command mode }
  522.       
  523.     begin
  524.       WriteLn(com);
  525.       WriteLn(com, 'Message not filed.');
  526.       stop_msg := True;
  527.       mult_cmds := False;
  528.       Cmd_Queue := '';
  529.     end;
  530.     
  531.     
  532.     function open_quote_msg : Boolean;
  533.     
  534.     begin
  535.       Assign(Byte_file, MsgToQuote+'.MSG');
  536.       {$I-}
  537.       Reset(Byte_file) {$I+} ;
  538.       OK := (IoResult = 0);
  539.       if OK then
  540.         begin
  541.           {$I-}
  542.           Seek(Byte_file, 190) {$I+} ;
  543.           open_quote_msg := (IoResult = 0)
  544.         end
  545.       else
  546.         open_quote_msg := False;
  547.     end;
  548.     
  549.     
  550.     
  551.   begin                           {message enter}
  552.     if AreaReq = 'NETMAIL' then
  553.       fido_area := fidomail
  554.     else
  555.       fido_area := fidomail+'\'+AreaReq;
  556.     mname := AreaReq;
  557.     if Pos('-', mname) = 1 then
  558.       Delete(mname, 1, 1);
  559.     mname := Copy(mname, 1, 8)+'.MSG';
  560.     abort := False;
  561.     attached_file := False;
  562.     low := 1;
  563.     SetSect(fidolists);
  564.     OK := ExistFile(netlist) and ExistFile(nodelist);
  565.     SetSect(HomName);
  566.     if (not OK) then
  567.       begin
  568.         WriteLn(com);
  569.         WriteLn(com, 'Can''t find Node List files,  aborting...')
  570.       end
  571.     else if (AreaReq = 'NETMAIL') and (not In_Conference) then
  572.       list('H')
  573.     else if user_rec.access < val_acc then
  574.       list('D')
  575.     else
  576.       begin
  577.         if to_ctrl <> 'R' then
  578.           fido_sort(high_msg_num, Number, msg_numbers)
  579.         else
  580.           begin
  581.             high_msg_num := last_msg_num;
  582.             quote := ask('Quote message', 'N')
  583.           end;
  584.         WriteLn(com);
  585.         Inc(high_msg_num);
  586.         Str(high_msg_num, msgnum);
  587.         FidoDrv := Copy(fidomail, 1, 3);
  588.         if (diskfree(Ord(Upcase(FidoDrv[1]))-64) div 1024) > maxfree_abs then
  589.           begin
  590.             if (diskfree(Ord(Upcase(FidoDrv[1]))-64) div 1024) <= maxfree_mslimit then
  591.               begin
  592.                 limit_lines := True;
  593.                 max_msg_lines := maxfree_lines;
  594.               end;
  595.             if to_ctrl <> 'R' then
  596.               begin
  597.                 abort := False;
  598.                 WriteLn(com);
  599.                 to_name := '';
  600.                 if (user_rec.access >= 250) and (AreaReq = 'NETMAIL') then
  601.                   begin
  602.                     if (ask('Attach File', 'N')) then
  603.                       begin
  604.                         WriteLn(com);
  605.                         subj := prompt('   File: ', 71, 'EL');
  606.                         if ExistFile(subj) then
  607.                           begin
  608.                             if Pos('\', subj) = 0 then
  609.                               begin
  610.                                 abort := True;
  611.                                 WriteLn(com);
  612.                                 WriteLn(com, 'Full path name must be specified, aborting..')
  613.                               end
  614.                             else
  615.                               begin
  616.                                 set_bit(low, 4);
  617.                                 attached_file := True;
  618.                               end;
  619.                           end
  620.                         else
  621.                           begin
  622.                             abort := True;
  623.                             WriteLn(com);
  624.                             WriteLn(com, 'Couldn''t find file, aborting..')
  625.                           end;
  626.                       end;
  627.                     WriteLn(com);
  628.                   end;
  629.                 if (not abort) then
  630.                   begin
  631.                     WriteLn(com, '   From:   ', UserFullName);
  632.                     to_name := prompt('     To: ', 35, 'EL');
  633.                     to_name := StUpcase(to_name);
  634.                     if to_name = '' then
  635.                       to_name := 'All';
  636.                   end;
  637.                 if (not abort) and (not test_bit(low, 4)) then
  638.                   subj := prompt('Subject: ', 71, 'EL');
  639.                 WriteLn(com);
  640.                 if subj = '' then
  641.                   subj := '...';
  642.                 if (not abort) and (AreaReq[1] <> '-') then
  643.                   begin
  644.                     repeat
  645.                       node_entrd := False;
  646.                       repeat
  647.                         reply := prompt('Net  (or CR for List) ', 9, 'ES');
  648.                         if reply = '?' then
  649.                           reply := ' ';
  650.                         if reply = ' ' then
  651.                           begin
  652.                             show_nets;
  653.                             WriteLn(com);
  654.                             WriteLn(com)
  655.                           end;
  656.                       until (reply <> ' ') or (not Online);
  657.                       position := Pos('/', reply);
  658.                       if position <> 0 then
  659.                         begin
  660.                           temp_str := Copy(reply, Succ(position), 4);
  661.                           msg_hdr.dest_node := strint(temp_str);
  662.                           Delete(reply, position, 5);
  663.                           node_entrd := True
  664.                         end;
  665.                       msg_hdr.dest_net := strint(reply);
  666.                       check_net(msg_hdr.dest_net, offset, nodes, OK);
  667.                       if (not OK) and (msg_hdr.dest_net <> 0) then
  668.                         begin
  669.                           WriteLn(com, 'No such Net, try again.');
  670.                           node_entrd := False
  671.                         end;
  672.                       abort := (msg_hdr.dest_net = 0);
  673.                     until OK or (not Online) or abort;
  674.                     repeat
  675.                       if (not node_entrd) then
  676.                         begin
  677.                           repeat
  678.                             reply := prompt('Node (CR for List) ', 4, 'ES');
  679.                             if reply = '?' then
  680.                               reply := ' ';
  681.                             if (reply = ' ') then
  682.                               begin
  683.                                 show_nodes(offset, nodes);
  684.                                 WriteLn(com);
  685.                                 WriteLn(com)
  686.                               end;
  687.                           until ((reply <> ' ') and (reply[1] in ['0'..'9']))
  688.                           or (not Online);
  689.                           msg_hdr.dest_node := strint(reply);
  690.                         end;
  691.                       check_node(msg_hdr.dest_node, offset, nodes, OK);
  692.                       if (not OK) then
  693.                         begin
  694.                           WriteLn(com, 'No such Node, try again.');
  695.                           node_entrd := False
  696.                         end;
  697.                     until OK or (not Online);
  698.                   end;
  699.                 if AreaReq[1] = '-' then
  700.                   node_hdr.node_cost := 0;
  701.                 if (node_hdr.node_cost > user_rec.acct_bal) and (not abort) then
  702.                   begin
  703.                     list('H');
  704.                     abort := True
  705.                   end;
  706.               end
  707.             else
  708.               begin
  709.                 abort := False;
  710.                 msg_hdr.dest_net := msg_hdr.orig_net;
  711.                 msg_hdr.dest_node := msg_hdr.orig_node;
  712.                 if AreaReq[1] <> '-' then
  713.                   begin
  714.                     check_net(msg_hdr.dest_net, offset, nodes, OK);
  715.                     if OK then
  716.                       begin
  717.                         check_node(msg_hdr.dest_node, offset, nodes, OK);
  718.                         if node_hdr.node_cost > user_rec.acct_bal then
  719.                           begin
  720.                             list('H');
  721.                             abort := True
  722.                           end;
  723.                       end;
  724.                   end
  725.                 else
  726.                   begin
  727.                     OK := True;
  728.                     node_hdr.node_cost := 0
  729.                   end;
  730.                 if OK and (not abort) then
  731.                   begin
  732.                     subj_prompt := old_subject;
  733.                     WriteLn(com, 'From: ', UserFullName);
  734.                     WriteLn(com, '  To: ', to_name);
  735.                     Write(com, '  Re: ');
  736.                     GetStr(subj_prompt, ch, 72, 'EL');
  737.                     subj := subj_prompt;
  738.                     WriteLn(com)
  739.                   end
  740.                 else if (not abort) then
  741.                   begin
  742.                     WriteLn(com, 'Couldn''t locate the senders Node.  Aborting....');
  743.                     abort := True
  744.                   end;
  745.               end;
  746.             if OK and (not abort) then
  747.               begin
  748.                 WriteLn(com);
  749.                 if limit_lines then
  750.                   begin
  751.                     WriteLn(com, 'Message is limited to ', max_msg_lines, ' lines.');
  752.                     WriteLn(com);
  753.                   end;
  754.                 WriteLn(com, 'When Message finished, enter an empty line. <CR>');
  755.                 WriteLn(com, 'Ready for message...');
  756.                 TextBase := nil;
  757.                 last_line := 1;
  758.                 SetSect(fido_area);
  759.                 if quote then
  760.                   begin
  761.                     quote := open_quote_msg;
  762.                     if quote and local_online then
  763.                       begin
  764.                         SetSect(HomName);
  765.                         Assign(quote_file, mname);
  766.                         Rewrite(quote_file);
  767.                         SetSect(fido_area);
  768.                         next_inpstr := '';
  769.                         msg_line := ' ';
  770.                         while (not brk) and (msg_line <> '') and (Online) do
  771.                           begin
  772.                             msg_line := next_inpstr;
  773.                             GetLine(msg_line);
  774.                             if msg_line <> '' then
  775.                               begin
  776.                                 SetSect(HomName);
  777.                                 Write(quote_file, msg_line);
  778.                                 SetSect(fido_area);
  779.                               end
  780.                           end;
  781.                         SetSect(HomName);
  782.                         Close(quote_file);
  783.                         SetSect(fido_area);
  784.                       end;
  785.                   end;
  786.                 if (not local_online) then
  787.                   fido_mesg_input(last_line);
  788.                 if quote then
  789.                   Close(Byte_file);
  790.                 if local_online then
  791.                   make_fido_message(AreaReq, '', user_loc, 0, subj, True,
  792.                     to_name, msg_hdr.dest_net, msg_hdr.dest_node, attached_file);
  793.                 SetSect(HomName);
  794.                 stop_msg := False;
  795.                 if TextBase <> nil then
  796.                   begin
  797.                     repeat
  798.                       WriteLn(com);
  799.                       if quote then
  800.                         begin
  801.                           st := 'L';
  802.                           quote := False
  803.                         end
  804.                       else
  805.                         st := prompt('Edit command <C><D><E><I><L><S><Q><?>', 80, 'ES?');
  806.                       if Length(st) = 1 then
  807.                         ch := st[1]
  808.                       else
  809.                         st := ' ';
  810.                       case ch of
  811.                         'C' :
  812.                           fido_mesg_input(last_line);
  813.                         'D' :
  814.                           begin
  815.                             fido_mesg_delete;
  816.                             fido_mesg_print;
  817.                           end;
  818.                         'E' :
  819.                           fido_mesg_edit;
  820.                         'I' :
  821.                           begin
  822.                             fido_mesg_insert_line;
  823.                             fido_mesg_print;
  824.                           end;
  825.                         'L' :
  826.                           fido_mesg_print;
  827.                         'S' :
  828.                           begin
  829.                             if (AreaReq[1] <> '-') and (node_hdr.node_cost > 0) then
  830.                               begin
  831.                                 WriteLn(com);
  832.                                 Write(com, 'This message will cost ',
  833.                                   node_hdr.node_cost, ' cents. ');
  834.                                 if ask('Do you want to send it', 'Y') then
  835.                                   fido_mesg_save(subj, stop_msg)
  836.                                 else
  837.                                   fido_mesg_quit(stop_msg);
  838.                               end
  839.                             else
  840.                               fido_mesg_save(subj, stop_msg)
  841.                           end;
  842.                         'Q' :
  843.                           fido_mesg_quit(stop_msg)
  844.                       else
  845.                         list('E');
  846.                       end;
  847.                     until (not Online) or (stop_msg and (ch in ['C', 'D', 'E', 'I', 'L',
  848.                       'S', 'Q']));
  849.                   end
  850.                 else if (not local_online) then
  851.                   WriteLn(com, 'Unable to continue message  - aborting. ');
  852.                 while TextBase <> nil do
  853.                   begin
  854.                     This := TextBase; { Get rid of list elements }
  855.                     TextBase := TextBase^.next;
  856.                     Dispose(This)
  857.                   end;
  858.               end;                {OK}
  859.           end                     {enough disk space and allowed}
  860.         else
  861.           begin
  862.             if test_bit(user_rec.flags, 4) then
  863.               WriteLn(com, 'Unable to accept messages.')
  864.             else
  865.               WriteLn(com, 'Not enough disk space for messages.');
  866.           end;
  867.       end;
  868.   end;
  869.   
  870.   
  871. end.                              { of NETENTR.PAS}
  872. 
  873.